2 using System.Collections.Generic;
6 namespace SuperPolarity
10 public IList<Widget> Children;
11 public Dictionary<string, List<Action<float>>> Listeners;
13 public virtual void AppendChild(Widget widget)
18 public virtual void Bind(string eventName, Action<float> eventListener)
20 List<Action<float>> newListenerList;
21 List<Action<float>> listenerList;
24 if (!Listeners.ContainsKey(eventName))
26 newListenerList = new List<Action<float>>();
27 Listeners.Add(eventName, newListenerList);
30 foundListeners = Listeners.TryGetValue(eventName, out listenerList);
32 listenerList.Add(eventListener);
35 public virtual void Unbind(string eventName, Action<float> eventListener)
37 // NOT YET IMPLEMENTED;
40 public virtual void Dispatch(string eventName, float value)
42 List<Action<float>> listenerList;
45 foundListeners = Listeners.TryGetValue(eventName, out listenerList);
52 foreach (Action<float> method in listenerList)